import { getToken, setToken, removeToken } from '@/utils/auth'
import { login } from '@/api/user'
export default {
  namespaced: true,
  state: {
    token: getToken()
  },
  getters: {
  },
  mutations: {
    SET_TOKEN (state, val) {
      state.token = val
      setToken(val)
    },
    DEL_TOKEN (state) {
      state.token = null
      removeToken()
    }
  },
  actions: {
    async login ({ commit }) {
      await login({
        mobile: '13800000002',
        password: '123456'
      })
      console.log('1111')
      // commit('SET_TOKEN', res.data)
      // this.$store.commit('SET_TOKEN', res.data)
      // console.log(res.data)
    }
  }
}
